<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录 - 测盟汇系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        :root {
            --primary-color: #2c5545; /* 墨绿色主色调 */
            --primary-light: #3a7d62; /* 稍亮的墨绿 */
            --primary-hover: #1e4636; /* 深墨绿 */
            --accent-color: #8ba888; /* 辅助色 */
            --error-color: #d64541; /* 错误提示色 */
            --text-color: #333;
            --text-light: #555;
            --border-color: #d1d9d6; /* 浅灰绿边框 */
            --bg-light: #f5f7f6; /* 浅灰绿背景 */
            --bg-page: #e8ecea; /* 页面背景 */
            --white: #fff;
            --shadow: 0 4px 24px rgba(44, 85, 69, 0.1); /* 墨绿色阴影 */
            --radius: 12px;
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: var(--bg-page);
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: var(--text-color);
            line-height: 1.6;
        }

        .container {
            width: 100vw;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #f5f7f6 0%, #e1e8e4 100%);
            padding: 20px;
        }

        .card {
            background: var(--white);
            padding: 2.5rem;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            width: 100%;
            max-width: 420px;
            position: relative;
            overflow: hidden;
            transition: var(--transition);
            border: 1px solid rgba(44, 85, 69, 0.1);
        }

        .card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 5px;
            background: var(--primary-color);
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(44, 85, 69, 0.15);
        }

        .logo {
            text-align: center;
            margin-bottom: 1.5rem;
        }

        .logo i {
            font-size: 2.5rem;
            color: var(--primary-color);
            margin-bottom: 0.5rem;
        }

        h2 {
            text-align: center;
            margin-bottom: 1.8rem;
            color: var(--primary-color);
            font-weight: 600;
            letter-spacing: 1px;
        }

        .form-group {
            margin-bottom: 1.5rem;
            position: relative;
        }

        .form-group i {
            position: absolute;
            left: 15px;
            top: 42px;
            color: var(--primary-light);
            font-size: 1rem;
        }

        label {
            display: block;
            margin-bottom: 0.6rem;
            color: var(--primary-color);
            font-weight: 500;
        }

        input[type="text"],
        input[type="password"] {
            width: 100%;
            padding: 0.8rem 0.8rem 0.8rem 2.5rem;
            margin-bottom: 0.2rem;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            font-size: 1rem;
            background: var(--bg-light);
            transition: var(--transition);
            color: var(--text-color);
        }

        input[type="text"]:focus,
        input[type="password"]:focus {
            border-color: var(--primary-color);
            outline: none;
            box-shadow: 0 0 0 2px rgba(44, 85, 69, 0.2);
            background: var(--white);
        }

        .error {
            color: var(--error-color);
            margin: 0.8rem 0;
            text-align: center;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(214, 69, 65, 0.1);
            padding: 0.5rem;
            border-radius: 4px;
        }

        .error i {
            margin-right: 0.5rem;
        }

        button {
            width: 100%;
            padding: 0.9rem;
            background: var(--primary-color);
            color: var(--white);
            border: none;
            border-radius: 6px;
            font-size: 1rem;
            font-weight: 500;
            cursor: pointer;
            transition: var(--transition);
            margin-top: 0.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
            letter-spacing: 1px;
        }

        button i {
            margin-right: 0.5rem;
        }

        button:hover {
            background: var(--primary-hover);
            transform: translateY(-2px);
        }

        .links {
            display: flex;
            justify-content: space-between;
            margin-top: 1.5rem;
            font-size: 0.95rem;
        }

        .links a {
            color: var(--primary-light);
            text-decoration: none;
            transition: var(--transition);
            display: flex;
            align-items: center;
        }

        .links a:hover {
            color: var(--primary-color);
            text-decoration: underline;
        }

        .links a i {
            margin-right: 0.3rem;
        }

        .footer {
            text-align: center;
            margin-top: 2rem;
            color: var(--primary-light);
            font-size: 0.9rem;
            padding-top: 1rem;
            border-top: 1px solid var(--border-color);
        }

        /* 添加一些自然元素装饰 */
        .leaf-decoration {
            position: absolute;
            opacity: 0.1;
            z-index: -1;
        }

        .leaf-1 {
            top: -30px;
            right: -30px;
            font-size: 8rem;
            color: var(--primary-color);
            transform: rotate(30deg);
        }

        .leaf-2 {
            bottom: -20px;
            left: -20px;
            font-size: 6rem;
            color: var(--accent-color);
            transform: rotate(-15deg);
        }

        .register-options {
            margin-top: 1rem;
            text-align: center;
        }

        .register-options p {
            color: var(--text-light);
            margin-bottom: 0.5rem;
            font-size: 0.9rem;
        }

        .register-buttons {
            display: flex;
            gap: 10px;
            margin-top: 0.5rem;
        }

        .register-buttons a {
            flex: 1;
            padding: 0.7rem;
            background: var(--bg-light);
            color: var(--primary-color);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            font-size: 0.9rem;
            text-align: center;
            text-decoration: none;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .register-buttons a:hover {
            background: var(--primary-light);
            color: var(--white);
            border-color: var(--primary-light);
        }

        .register-buttons a i {
            margin-right: 0.5rem;
        }

        @media (max-width: 480px) {
            .card {
                padding: 1.8rem;
            }

            h2 {
                font-size: 1.4rem;
            }

            .leaf-decoration {
                display: none;
            }

            .register-buttons {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <div class="card">
        <i class="fas fa-leaf leaf-decoration leaf-1"></i>
        <i class="fas fa-leaf leaf-decoration leaf-2"></i>

        <div class="logo">
            <i class="fas fa-store"></i>
        </div>
        <h2>欢迎登录测盟汇系统</h2>
        <form th:action="@{/user/login}" method="post">
            <div class="form-group">
                <label for="username">账号</label>
                <i class="fas fa-user"></i>
                <input type="text" id="username" name="username" placeholder="请输入账号" required />
            </div>

            <div class="form-group">
                <label for="password">密码</label>
                <i class="fas fa-lock"></i>
                <input type="password" id="password" name="password" placeholder="请输入密码" required />
            </div>

            <div th:if="${error}" class="error">
                <i class="fas fa-exclamation-circle"></i>
                <span th:text="${error}"></span>
            </div>

            <button type="submit">
                <i class="fas fa-sign-in-alt"></i> 登录
            </button>

            <div class="register-options">
                <p>还没有账号？</p>
                <div class="register-buttons">
                    <a th:href="@{/user/register}">
                        <i class="fas fa-user"></i> 用户注册
                    </a>
                    <a th:href="@{/enterprise/register}">
                        <i class="fas fa-building"></i> 企业注册
                    </a>
                </div>
            </div>

            <div class="links">
                <a th:href="@{/user/forgot-password}">
                    <i class="fas fa-key"></i> 忘记密码
                </a>
            </div>
        </form>

        <div class="footer">
            <p>© 2025 测盟汇系统 | 版本 1.0.0</p>
        </div>
    </div>
</div>

<script>
    // 自动聚焦到用户名输入框
    document.addEventListener('DOMContentLoaded', function() {
        document.getElementById('username').focus();
    });
</script>
</body>
</html>